@extends('admin.layout.main')

@section('content')
    <div class="breadcrumbs ace-save-state" id="breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="#">首页</a>
            </li>
        </ul><!-- /.breadcrumb -->
    </div>

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" role="form"  method="post" enctype="multipart/form-data">{{csrf_field()}}
                <div class="form-group">
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-2">*买入币种 </label>
                    <div class="col-sm-9">
                        <input  type="radio" name="type"  value="1">手机号 &nbsp;<input type="radio" name="type"  value="2">邮箱<br>
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">*用户账号 </label>

                    <div class="col-sm-9">
                        <input type="text" id="form-field-1" name="name" value="" placeholder="用户账号" class="col-xs-10 col-sm-5" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">*货币选择 </label>

                    <div class="col-sm-9">
                        <select name="cid">
                            <option value="0">选择币种</option>
                            @foreach($infos as $key=>$val)
                                <option value="{{$val['id']}}">{{$val['name']}}({{$val['name_en']}})</option>
                            @endforeach
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right" for="form-field-1">*充值数量(只能输入整数，小数点后的数字无效) </label>

                    <div class="col-sm-9">
                        <input type="text" id="form-field-1" name="value" value="" placeholder="数量" class="col-xs-10 col-sm-5"   onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  />
                    </div>
                </div>

                <div class="clearfix form-actions">
                    <div class="col-md-offset-3 col-md-9">
                        {{--<input class="btn btn-info" type="submit">--}}
                        <button class="btn btn-info" type="button" onclick="on_add()">
                            {{--<button class="btn btn-info" type="submit">--}}
                            <i class="ace-icon fa fa-check bigger-110"></i>
                            提交
                        </button>

                        &nbsp; &nbsp; &nbsp;
                        <button class="btn" type="reset">
                            <i class="ace-icon fa fa-undo bigger-110"></i>
                            返回
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    </div><!-- /.main-content -->
    <script>
        function on_add() {
            $.ajax({
                type : "POST",
                url:'/admin/top_up_submit',
                data : $('form').serialize(),
                time : 2000,
                success: function(res){
                        if(res.status == 1){
                            layer.msg('添加成功',{icon:1})
                            location.href= '/admin/top_up'
                        }else{
                            layer.msg(res.msg, {icon: 2});
                        }
                }
            });
        }
    </script>
@endsection
